package com.stms.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtil {

	private static String connStr = "jdbc:mysql://127.0.0.1:3306/stu_db?characterEncoding=UTF-8";
	private static String dbuName="root";
	private static String dbpWord="320455cj";
	
	private static Connection connection;
	static{
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");
			connection = DriverManager.getConnection(connStr,dbuName,dbpWord);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static Connection getConnection(){
		return connection;
	}
}
